function Ice() 
{
	/* Add initialization code here */
	var row_no=1;
	this.sample=new Fireice();
}
Ice.prototype = {

		//Other functions
		onOk:function()
		{
	if(document.getElementById('local').selected)
	{
		var opt={};
		opt.server=document.getElementById('local-file-name').value;
		var options =JSON.stringify(opt);
		try
		{
			dump(this.sample.recording);
			if(this.sample.recording)
			{
				dump("Error in Recording");
			}
			else
			{
				this.sample.record(options);
			}

		}
		catch (e)
		{
			dump("getting some error :-/ "+e);
		}

	}
	else
	{
		var opt = {};			
		opt.server= document.getElementById('stream-server-address').value;
		opt.port = document.getElementById('stream-port-no').value;
		opt.password = document.getElementById('stream-password').value;
		opt.mount = document.getElementById('stream-mount-point').value;
		var options = JSON.stringify(opt);

		try
		{
			dump(this.sample.recording);
			if(this.sample.recording)
			{
				dump("Error in Recording");
			}
			else
			{
				this.sample.record(options);
			}
		}
		catch (e)
		{
			dump("getting some error :-/ "+e);
		}

	}
	var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
	                            .getService(Components.interfaces.nsIWindowMediator);
	var browserWindow = wm.getMostRecentWindow("navigator:browser");

	browserWindow.document.getElementById("nav-record").setAttribute('label', 'Stop');
	return true;
		},
		onCancel:function()
		{
			return false;
		},
		vumeter:function()
		{
			if(document.getElementById('nav-vumeter').checked)
			{
				var alertsService = Components.classes["@mozilla.org/alerts-service;1"]
				                                       .getService(Components.interfaces.nsIAlertsService);
				alertsService.showAlertNotification("NULL","VU Meter Show","VU Meter is here.",false,"",null);
			}
			else
			{
				var alertsService = Components.classes["@mozilla.org/alerts-service;1"]
				                                       .getService(Components.interfaces.nsIAlertsService);
				alertsService.showAlertNotification("NULL","VU Meter hide","VU Meter hided.",false,"",null);
			}

		},
		pref:function()	
		{
			var pre = window.openDialog("chrome://fireice/content/options.xul","Preferences", "NULL");
		},
		record:function()
		{
			if(document.getElementById("nav-record").label =="Stream to Icecast server")
			{
				var win = window.openDialog("chrome://fireice/content/record-option.xul","record-options",  document.getElementById('nav-record'));
			}
			else if (document.getElementById("nav-record").label =="Stop")
			{
				dump(this.sample.recording);
				this.sample.stop();
			}

		}
}
var ice =new Ice();



